package com.lovo.homework7_18IOStream;

import java.io.*;
import java.util.Scanner;

public class AppendTest {
    private static Scanner sc = new Scanner(System.in);
    public void append(){
        FileOutputStream fw = null;
        try {
            System.out.println("请输入追加的内容：");
            String str = sc.next();
            fw = new FileOutputStream("e:/e.txt",true);
            fw.write(str.getBytes());
        }catch (FileNotFoundException e){
            e.printStackTrace();
        }catch (IOException e){
            e.printStackTrace();
        }finally {
            if (fw!=null){
                try {
                    fw.close();
                }catch (IOException e){
                    e.printStackTrace();
                }
            }
        }
    }
    public static void main(String[] args) {
        AppendTest appendTest= new AppendTest();
        appendTest.append();
    }
}
